package neu.soft.controller;

import neu.soft.service.impl.OutOrderServiceImpl;
import neu.soft.vo.PageBean;
import neu.soft.vo.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/outOrder")
@CrossOrigin
public class OutOrderController {
    @Autowired
    private OutOrderServiceImpl outOrderService;

    @RequestMapping("/addOutOrder")
    public ResultBean<Integer> addOutOrder(@RequestBody Map<String,Object> map){
        return outOrderService.addOutOrder(map);
    }

    /**
     * outOrderId 出库单id
     * GROUP_CONCAT(d.distributionOrderId) 该出库单下包含的所有分发单id
     * GROUP_CONCAT(distributeTime) 分发单对应的分发时间
     * GROUP_CONCAT(company) 分发单对应的运输公司
     * GROUP_CONCAT(code) 分发单下的所有商品id
     * GROUP_CONCAT(num) 商品的对应数量
     * outTime 这一批货的出库时间
     * outWarehouseId 这一批货是从哪个仓库出的
     * @param map
     * @return
     */
    @RequestMapping("/queryOutOrder")
    public ResultBean<PageBean<Map<String,Object>>> queryOutOrder(@RequestBody Map<String,Object> map){
        return outOrderService.queryOutOrder(map);
    }
    @RequestMapping("/queryMingXi")
    public ResultBean<List<Map<String,Object>>> queryMingXi(@RequestBody Map<String,Object> map){
        return outOrderService.queryMingXi(map);
    }
}
